import Api from '@/utils/request';

const requestApi = new Api('http://localhost:3000/api');

/**
 * 通过id找到博客
 * @param id
 * @returns {Promise | Promise<any>}
 */
export const findBlogById = (id) => {
	return requestApi.connection('get', `/blog/find/${id}`);
};

/**
 * 统计用户的所有博客数量
 * @param id
 * @returns {Promise | Promise<any>}
 */
export const countBlogs = (id) => {
	return requestApi.connection("get", `/blog/countBlogs/${id}`);
};

/**
 * 顺序查找所有博客
 * @param currentPage
 * @param size
 * @param id
 * @returns {Promise | Promise<any>}
 */
export const getAllBlogs = (currentPage, size, id) => {
	return requestApi.connection("get", `/blog/sortOrder`, {
		currentPage: currentPage,
		size: size,
		id: id,
	});
};
